home *** CD-ROM | disk | FTP | other *** search
- import java.applet.Applet;
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.Cursor;
- import java.awt.Font;
- import java.awt.Graphics;
- import java.awt.Label;
- import java.awt.LayoutManager;
- import java.awt.event.MouseEvent;
- import java.awt.event.MouseListener;
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStream;
- import java.io.InputStreamReader;
- import java.net.MalformedURLException;
- import java.net.URL;
- import java.net.URLEncoder;
-
- public class Table extends Applet implements MouseListener {
- // $FF: renamed from: wi int
- private int field_0;
- // $FF: renamed from: he int
- private int field_1;
- private int NCol;
- private int NRow;
- private String[][] data;
- private Color backColor;
- private Color backColor2;
- private Color columnsColor;
- private int mode;
- private int heMax;
- private int space = 10;
- private int titleMode;
- private int skip;
- private String statusBarText;
- private String link;
- private int border;
- private Color borderColor;
- private int wspace;
-
- public String getAppletInfo() {
- return "Name: Table\r\nAuthor: Taiji Software";
- }
-
- public void register() {
- try {
- URL u = new URL("http://www.taijisoftware.com");
- ((Applet)this).getAppletContext().showDocument(u, "_blank");
- } catch (Exception e) {
- System.out.println(e);
- this.stop();
- }
- }
-
- public void init() {
- String codeBase = null;
-
- try {
- codeBase = (new URL(((Applet)this).getCodeBase().toString())).getHost();
- System.out.println("Copyright 1999, 2001 Taiji Software(tm)\nYour domain name is : " + codeBase);
- codeBase = codeBase.toUpperCase();
- } catch (Exception var13) {
- }
-
- if (!((Applet)this).getCodeBase().toString().toUpperCase().startsWith("FILE") || ((Applet)this).getParameter("debug") != null) {
- String regCode = ((Applet)this).getParameter("registration_code");
- if (regCode == null) {
- regCode = ((Applet)this).getParameter("reg_domain");
- if (regCode == null) {
- this.register();
- } else {
- if (regCode.length() == codeBase.length() + 4 && !codeBase.startsWith("WWW.")) {
- codeBase = "WWW." + codeBase;
- } else if (regCode.length() == codeBase.length() - 4 && codeBase.startsWith("WWW.")) {
- codeBase = codeBase.substring(4);
- }
-
- char[] chars = new char[codeBase.length()];
- codeBase.getChars(0, codeBase.length(), chars, 0);
- String key = new String("haricot");
- char[] chars2 = new char[key.length()];
- key.getChars(0, key.length(), chars2, 0);
-
- for(int i = 0; i < codeBase.length(); ++i) {
- int j;
- if (i >= key.length()) {
- j = i - key.length() * (i / key.length());
- } else {
- j = i;
- }
-
- chars[i] += chars2[j];
- chars[i] = (char)(chars[i] - chars[i] / 26 * 26 + 97);
- }
-
- String res = new String(chars);
- if (!res.equalsIgnoreCase(regCode)) {
- this.register();
- }
- }
- } else if (!regCode.equals("settevercsedegnamiaj") && !regCode.equals("8078")) {
- this.register();
- }
- }
-
- this.getParameters();
-
- try {
- String s = "";
- InputStream in = null;
- in = (new URL(((Applet)this).getCodeBase(), ((Applet)this).getParameter("data_file"))).openStream();
- BufferedReader br = new BufferedReader(new InputStreamReader(in));
-
- while((s = br.readLine()) != null) {
- try {
- if (this.NCol == 0) {
- int p;
- while((p = s.indexOf(",")) != -1) {
- ++this.NCol;
- s = s.substring(p + 1);
- }
-
- ++this.NCol;
- }
-
- ++this.NRow;
- } catch (Exception var16) {
- }
- }
-
- br.close();
- } catch (IOException e) {
- System.out.println("data file read error !" + e);
- }
-
- ((Component)this).setBackground(this.backColor);
- int NRows = this.NRow;
- if (this.titleMode == 1) {
- NRows = this.NRow + 1;
- } else if (this.titleMode == 2) {
- NRows = this.NRow + 2;
- }
-
- if (this.skip == 1) {
- --NRows;
- }
-
- this.data = new String[NRows][this.NCol];
-
- try {
- String s = "";
- InputStream in = null;
- in = (new URL(((Applet)this).getCodeBase(), ((Applet)this).getParameter("data_file"))).openStream();
- BufferedReader br = new BufferedReader(new InputStreamReader(in));
- int i = 0;
-
- while(true) {
- if (i == 0 && this.skip == 1) {
- s = br.readLine();
- }
-
- if (i == 0 && this.titleMode == 2) {
- s = ((Applet)this).getParameter("title_row");
- } else {
- s = br.readLine();
- if (s == null) {
- br.close();
- break;
- }
- }
-
- try {
- if (i == 1 && this.titleMode != 0) {
- for(int j = 0; j < this.NCol - 1; ++j) {
- this.data[i][j] = "";
- }
-
- ++i;
- }
-
- for(int j = 0; j < this.NCol - 1; ++j) {
- int p = s.indexOf(",");
- this.data[i][j] = s.substring(0, p);
- s = s.substring(p + 1);
- }
-
- this.data[i][this.NCol - 1] = s;
- } catch (Exception var14) {
- }
-
- ++i;
- }
- } catch (IOException e) {
- System.out.println("data file read error !" + e);
- }
-
- ((Container)this).setLayout((LayoutManager)null);
- int[] wiMax = new int[this.NCol];
-
- for(int i = 0; i < this.NCol; ++i) {
- wiMax[i] = 0;
- }
-
- this.heMax = 0;
-
- for(int i = 0; i < this.data.length; ++i) {
- for(int j = 0; j < this.NCol; ++j) {
- Label ll = new Label(this.data[i][j]);
- ((Component)ll).setVisible(false);
- ((Container)this).add(ll);
- if (this.titleMode != 0) {
- Font f = ((Component)ll).getFont();
- ((Component)ll).setFont(new Font("TimesRoman", 1, f.getSize()));
- }
-
- if (((Component)ll).getPreferredSize().height > this.heMax) {
- this.heMax = ((Component)ll).getPreferredSize().height;
- }
-
- if (((Component)ll).getPreferredSize().width > wiMax[j]) {
- wiMax[j] = ((Component)ll).getPreferredSize().width;
- }
-
- ((Container)this).remove(ll);
- }
- }
-
- int wiPos = 0;
- int hePos = 0;
-
- for(int i = 0; i < this.data.length; ++i) {
- for(int j = 0; j < this.NCol; ++j) {
- if (j == 0) {
- wiPos = 0;
- }
-
- Label l = new Label(this.data[i][j]);
- if (i % 2 == 0) {
- ((Component)l).setBackground(this.backColor2);
- }
-
- String s = ((Applet)this).getParameter("columns_color" + Integer.toString(j + 1));
- if (s != null) {
- ((Component)l).setForeground(this.getColor("columns_color" + Integer.toString(j + 1)));
- } else {
- ((Component)l).setForeground(this.columnsColor);
- }
-
- ((Container)this).add(l);
- if (i == 0 && this.titleMode != 0) {
- Font f = ((Component)l).getFont();
- ((Component)l).setFont(new Font("TimesRoman", 1, f.getSize()));
- }
-
- ((Component)l).setBounds(wiPos + this.space + this.border, hePos + this.border, ((Component)l).getPreferredSize().width, ((Component)l).getPreferredSize().height);
- wiPos += wiMax[j] + this.wspace;
- if (j == this.NCol - 1) {
- hePos += this.heMax;
- }
- }
- }
-
- ((Component)this).repaint();
- }
-
- public void update(Graphics g) {
- this.paint(g);
- }
-
- public void paint(Graphics g) {
- if (this.mode == 1) {
- g.setColor(this.backColor2);
-
- for(int i = 0; i < this.data.length; i += 2) {
- g.fillRect(0, i * this.heMax + this.border, this.field_0, this.heMax);
- }
-
- if (this.border > 0) {
- g.setColor(this.borderColor);
-
- for(int i = 0; i < this.border; ++i) {
- g.drawRect(i, i, this.field_0 - 2 * i - 1, this.field_1 - 2 * i - 1);
- }
- }
-
- }
- }
-
- public void stop() {
- }
-
- public void getParameters() {
- this.field_0 = ((Component)this).getSize().width;
- this.field_1 = ((Component)this).getSize().height;
- String s = ((Applet)this).getParameter("title_mode");
- if (s != null) {
- this.titleMode = Integer.parseInt(s);
- }
-
- s = ((Applet)this).getParameter("skip_first_row");
- if (s != null) {
- this.skip = Integer.parseInt(s);
- }
-
- if (this.getColor("background_color") != null) {
- this.backColor = this.getColor("background_color");
- }
-
- if (this.getColor("background_color2") != null) {
- this.backColor2 = this.getColor("background_color2");
- this.mode = 1;
- }
-
- if (this.getColor("background_color") != null) {
- this.backColor = this.getColor("background_color");
- }
-
- if (this.getColor("columns_color") != null) {
- this.columnsColor = this.getColor("columns_color");
- }
-
- this.statusBarText = ((Applet)this).getParameter("status_bar_text");
- this.link = ((Applet)this).getParameter("link");
- s = ((Applet)this).getParameter("border");
- if (s != null) {
- this.border = Integer.parseInt(s);
- }
-
- if (this.getColor("border_color") != null) {
- this.borderColor = this.getColor("border_color");
- }
-
- s = ((Applet)this).getParameter("columns_space");
- if (s != null) {
- this.wspace = Integer.parseInt(s);
- }
-
- }
-
- private Color getColor(String param) {
- String s = ((Applet)this).getParameter(param);
- if (s != null) {
- if (s.substring(0, 1).equals("#")) {
- s = s.substring(1);
- int i = Integer.parseInt(s, 16);
- return new Color(i);
- } else {
- return null;
- }
- } else {
- return null;
- }
- }
-
- public URL giveURL(String url) {
- try {
- if (url.toUpperCase().startsWith("HTTP")) {
- return new URL(url);
- } else if (url.toUpperCase().startsWith("FTP")) {
- int p = url.indexOf(":");
- int p2 = url.indexOf(":", p + 1);
- if (p2 != -1) {
- url = url.substring(0, p + 3) + URLEncoder.encode(url.substring(p + 3, url.length()));
- }
-
- p = url.indexOf("%40");
- if (p != -1) {
- url = url.substring(0, p) + "@" + url.substring(p + 3, url.length());
- }
-
- return new URL(url);
- } else {
- return new URL(((Applet)this).getCodeBase(), url);
- }
- } catch (MalformedURLException e) {
- System.out.println(e);
- return null;
- }
- }
-
- public Table() {
- this.backColor = Color.white;
- this.backColor2 = Color.blue;
- this.columnsColor = Color.black;
- this.titleMode = 0;
- this.skip = 0;
- this.border = 0;
- this.borderColor = Color.black;
- ((Component)this).addMouseListener(this);
- }
-
- public void mouseClicked(MouseEvent e) {
- }
-
- public void mouseEntered(MouseEvent e) {
- if (this.statusBarText != null) {
- ((Applet)this).showStatus(this.statusBarText);
- }
-
- if (this.link != null) {
- ((Component)this).setCursor(new Cursor(12));
- }
-
- }
-
- public void mouseExited(MouseEvent e) {
- }
-
- public void mousePressed(MouseEvent e) {
- if (this.link != null) {
- String target = ((Applet)this).getParameter("target");
- if (target == null) {
- target = "_blank";
- }
-
- URL u = this.giveURL(this.link);
- ((Applet)this).getAppletContext().showDocument(u, target);
- }
-
- }
-
- public void mouseReleased(MouseEvent e) {
- }
- }
-